$(function() {
	var updateuserurl = '/user/updateuser';
	//提交
	$('#update').click(function() {
		var bloguser = {};
		bloguser.id = $('#userid').text();
		bloguser.username = $('#inplaceediting-username').text();
		bloguser.phone = $('#inplaceediting-phone').text();
		bloguser.email = $('#inplaceediting-email').text();
		bloguser.sex = $('#inplaceediting-sex').text().trim();
		if (bloguser.sex=='男'){
            bloguser.sex=0;
		} else if(bloguser.sex=='女'){
            bloguser.sex=1;
		}else if(bloguser.sex=='保密'){
            bloguser.sex=2;
		}
		// var userimg = $("#userimg")[0].files[0];

		var formData = new FormData();
        // formData.append('userimg', userimg);
		formData.append('BlogUserStr', JSON.stringify(bloguser));
		// var verifyCodeActual = $('#j_captcha').val();
		// if (!verifyCodeActual) {
		// 	$.toast('请输入验证码！');
		// 	return;
		// }
		// formData.append("verifyCodeActual", verifyCodeActual);
		$.ajax({
			// url : (isEdit? editShopUrl:addShopUrl),
			url : updateuserurl,
			type : 'POST',
			// contentType: "application/x-www-form-urlencoded; charset=utf-8",
			data : formData,
			contentType : false,
			processData : false,
			cache : false,
			success : function(data) {
				if (data.success) {
					$('.success').click();
                    window.setTimeout("window.location='/user/userprofile'",3000);
                    // if (isEdit){
					// 	$('#captcha_img').click();
					// } else{
					// 	window.location.href="/shopadmin/shoplist";
					// }
				} else {
					$('.fail-message').html(data.errMsg);
                    $('.addfail').click();
				}
			}
		});
	});

});